package com.jyou.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {
	private Log log = LogFactory.getLog(getClass());
	
	@RequestMapping(value="/welcome1", method = RequestMethod.GET)
	public ModelAndView printWelcome1(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws IOException {
		String data = request.getParameter("data");
		response.getWriter().write(getClass().getResource("/").getPath());
		log.debug(getClass().getResource("/").getPath() + "");
		return null;

	}
	
	@RequestMapping(value="/welcome2", method = RequestMethod.GET)
	public ModelAndView printWelcome2(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws IOException {
		String data = request.getParameter("data");
		response.getWriter().write(data + "welcome2");
		return null;

	}
}